package com.scsj.supermarket.presenter;

import android.util.Log;

import com.orhanobut.logger.Logger;
import com.scsj.supermarket.base.AlterLoginPwdBase;
import com.scsj.supermarket.base.SetRealNameBase;
import com.scsj.supermarket.bean.BaseBean;
import com.scsj.supermarket.model.AlterLoginPwdModel;
import com.scsj.supermarket.model.SetRealNameModel;

import dkmvp.mvp.BasePresenter;
import dkmvp.net.ResponseCallback;
import okhttp3.RequestBody;

/**
 * 修改登录密码presenter
 */

public class SetRealNamePresenter extends BasePresenter implements SetRealNameBase.IPresenter {

    private SetRealNameBase.IModel mModel;
    private SetRealNameBase.IView mView;

    public SetRealNamePresenter(SetRealNameBase.IView view) {
        mView = view;
        mModel = new SetRealNameModel();
    }


    @Override
    public void deliverData(RequestBody requestBody) {
        addSubscription(mModel.getData(requestBody, new ResponseCallback<BaseBean>() {
            @Override
            public void onSuccess(BaseBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showSuccessMsg("实名认证成功", result);
                    Logger.d("实名认证成功" + result.toString());
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
//                Log.e("实名认证失败onFaild", msg + "");
            }
        }));
    }

}
